import request from '@/utils/request'

export function add(data) {
  return request({
    url: '/sys/dept/save',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: '/sys/dept/delete',
    method: 'post',
    data: ids[0]
  })
}

export function edit(data) {
  return request({
    url: '/sys/dept/update',
    method: 'post',
    data
  })
}

export function getDeptList(id) {
  return request({
    url: '/sys/dept/list',
    method: 'get',
    params: {
      parentId: id
    }
  })
}

export function getDeptListAll(id) {
  return request({
    url: '/sys/dept/list/all',
    method: 'get',
    params: {
      parentId: id
    }
  })
}

export function getSubDeptList(id) {
  return request({
    url: '/sys/dept/sub_query',
    method: 'post',
    data: {
      deptId: id
    }
  })
}

export default { add, edit, del }

